<% layout('/layouts/default.html', {title: '商品管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(goods.isNewRecord ? '新增商品' : '编辑商品')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${goods}" action="${ctx}/shop/goods/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="goodsId"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('分类id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="categoryCode" maxlength="11" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('扩展分类id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="extendCategoryCode" maxlength="11" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品编号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="goodsSn" maxlength="60" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="goodsName" maxlength="120" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('点击数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="clickCount" maxlength="10" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('品牌id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="brandId" maxlength="5" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('库存数量')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="storeCount" maxlength="5" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('商品评论数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="commentCount" maxlength="5" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品重量克为单位')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="weight" maxlength="11" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品体积。单位立方米')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="volume" class="form-control required number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('市场价')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="marketPrice" class="form-control required number"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('本店价')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="shopPrice" class="form-control required number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('商品成本价')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="costPrice" class="form-control number"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('价格阶梯')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="priceLadder" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品关键词')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="keywords" maxlength="255" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('商品简单描述')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="goodsSummary" maxlength="255" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('商品详细描述')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="goodsContent" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('手机端商品详情')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="mobileContent" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('商品上传原始图')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:input path="goodsLogo" maxlength="255" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('是否为虚拟商品 1是，0否')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isVirtual" maxlength="3" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('虚拟商品有效期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="virtualIndate" maxlength="11" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('虚拟商品购买上限')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="virtualLimit" maxlength="6" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('是否允许过期退款， 1是，0否')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="virtualRefund" maxlength="1" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('是否上架 0-未上架 1-销售中')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isOnSale" maxlength="1" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('是否包邮0否1是')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isFreeShipping" maxlength="1" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品上架时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="onTime" maxlength="10" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品排序')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="goodsSort" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('是否推荐0-未推荐 1-已推荐')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isRecommend" maxlength="1" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('是否新品0-不是 1-是')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isNew" maxlength="1" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('是否热卖')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="isHot" maxlength="1" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('商品所属类型id，取值表goods_type的id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="goodsType" maxlength="5" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('商品规格类型，取值表goods_type的id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="specType" maxlength="5" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('购买商品赠送积分')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="giveIntegral" maxlength="8" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('积分兑换')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="exchangeIntegral" maxlength="10" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('供货商ID')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="suppliersId" maxlength="5" class="form-control required digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('商品销量')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="salesSum" maxlength="11" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('0默认1抢购2团购3优惠促销4预售5虚拟')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="promType" maxlength="1" class="form-control digits"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('优惠活动id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="promId" maxlength="11" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('佣金用于分销分成')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="commission" class="form-control number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('SPU')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="spu" maxlength="128" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('SKU')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="sku" maxlength="128" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('运费模板ID')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="templateId" maxlength="11" class="form-control digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('视频')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="goodsVideo" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('shop_id')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="shopId" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注信息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('图片上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadImage" bizKey="${goods.id}" bizType="goods_image"
									uploadType="image" class="" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('shop:goods:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>